//
//  SKError.swift
//  
//
//  Created by tangbl93 on 2021/2/6.
//

import StoreKit

public extension SKError {
    
    var yx_errorDescription: String {
        switch code {
        case .unknown: return "未知错误"
        case .clientInvalid: return "客户端无效"
        case .paymentCancelled: return "付款已取消"
        case .paymentInvalid: return "付款无效"
        case .paymentNotAllowed: return "不允许付款"
        case .storeProductNotAvailable: return "当前产品不可用"
        case .cloudServicePermissionDenied: return "云服务许可被拒绝"
        case .cloudServiceNetworkConnectionFailed: return "云服务网络连接失败"
        case .cloudServiceRevoked: return "云服务授权被撤销"
        case .privacyAcknowledgementRequired: return "尚未确认隐私政策"
        case .unauthorizedRequestData: return "未经授权的请求数据"
        case .invalidOfferIdentifier: return "标识符无效"
        case .invalidSignature: return "签名无效"
        case .missingOfferParams: return "缺少参数"
        case .invalidOfferPrice: return "当前价格不可用"
        case .overlayCancelled: return "已取消"
        case .overlayInvalidConfiguration: return "配置无效"
        case .overlayTimeout: return "超时"
        case .ineligibleForOffer: return "未满足条件"
        case .unsupportedPlatform: return "当前平台不可用"
        @unknown default:
            return "其他错误"
        }
    }
}
